<template>
  <div>
    <div>
      <div class="header-contact-num container">
        <div class="phone-num">
          <image class="phone-icon" src="/static/images/phone-active.png" />
          <div>咨询热线: {{base.zixundianhua}}</div>
        </div>
        <div class="go-phone" @click="phone">
          一键拨号
        </div>
      </div>
      <div class="space"></div>

      <div class="container new-title-box">
        <div class="new-title">{{news.title}}</div>
        <div class="new-submit-time">发布时间: {{news.inputtime1}}</div>
      </div>

      <div class="space"></div>

      <div class="content-wxparse">

        <wxParse  :content="info">  </wxParse>
      </div>

    </div>
    <Contact> </Contact>
  </div>
</template>

<script>
  const wxapp = getApp()
  import Contact from '@/components/Contact.vue'
  import wxParse from 'mpvue-wxparse'
  export default {
    data() {
      return {
        info : ``,
        news: []
      }
    },

    components: {
      wxParse,
      Contact
    },

    methods: {

      phone(){

        wx.makePhoneCall({
          phoneNumber: this.base.zixundianhua //仅为示例，并非真实的电话号码
        });
      },
      getInfo() {
        let that = this
        let id = this.$root.$mp.query.id
        if(!id) {
          wx.showToast({
            title: '参数不对.',
            icon: 'success',
            duration: 2000
          })
        }
        wx.request({
          url: wxapp.globalData.ROOT_URL, //仅为示例，并非真实的接口地址
          data: {
             id,
             service: 'App.Hong.GetDetailInfo',
             table: '5_news'
          },
          success: function(res) {
            that.info = res.data.data.result.content
            that.news = res.data.data.result
          }
        })

      }
    },

    onShow(){
      console.log('onShow',this.$root.$mp.appOptions);
    },
    onLoad() {
      let that = this
      wx.getStorage({
        key: 'base',
        success: function(res) {
            that.base = res.data
            console.log(that.base.zixundianhua)
        }
      })
      this.getInfo()
      console.log('onLoad',this.$root.$mp.query);
    }
  }
</script>
<style>
.wxParse view{
  padding: 0 10rpx;
}
</style>

<style scoped>
  .new-title-box{
    padding: 15rpx 10rpx;
  }

  .new-title-box .new-title{
    font-size: 30rpx;
  }
  .new-title-box .new-submit-time{
    font-size: 20rpx;
  }
  .content-wxparse{
    font-size: 25rpx;
    box-sizing: border-box;
    padding: 0 10rpx;
  }
  .header-contact-num{
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    line-height: 50rpx;
    height: 50rpx;
  }
  .header-contact-num .phone-num{
    display: flex;
    flex-direction: row;
    align-items: center;
    font-size: 30rpx;
  }
  .header-contact-num .phone-icon{
    width: 30rpx;
    height: 30rpx;
    margin-right: 10rpx;
  }
  .header-contact-num  .go-phone{
    font-size: 30rpx;
    color: #0099D9;
  }
  .space{
    width: 100%;
    height: 10rpx;
    background: #F2EDED;
  }
</style>
